var __extends =
    (this && this.__extends) ||
    (function () {
      var i = function (t, e) {
        return (i =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (i, t) {
              i.__proto__ = t;
            }) ||
          function (i, t) {
            for (var e in t)
              Object.prototype.hasOwnProperty.call(t, e) && (i[e] = t[e]);
          })(t, e);
      };
      return function (t, e) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof e && null !== e)
          throw new TypeError(
            "Class extends value " + String(e) + " is not a constructor or null"
          );
        i(t, e),
          (t.prototype =
            null === e
              ? Object.create(e)
              : ((a.prototype = e.prototype), new a()));
      };
    })(),
  FactionDetailDialog = (function (i) {
    function t() {
      var t = i.call(this) || this;
      return (
        WebSocketService.addListener({
          caller: t,
          code: 1196,
          method: t.onLoadBangPaiDetailFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 1197,
          method: t.onLoadBJiaruJiaoPaiFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 1222,
          method: t.onLoadBangPaiLiShiFn,
        }),
        t.btn_faction_jiaru.on(
          Laya.Event.CLICK,
          t,
          t.onDidClickJiaruBangPaiAction
        ),
        t
      );
    }
    return (
      __extends(t, i),
      (t.openFactionDetailView = function (i, e) {
        return (
          null == this.facDetailDig &&
            ((this.facDetailDig = new t()), (this.facDetailDig.zOrder = 1e3)),
          this.facDetailDig.popup(!0),
          (this.facDetailDig.facObj = i),
          (this.facDetailDig.type = e),
          "lishi" == e
            ? ((this.facDetailDig.image_bangpai_detail.visible = !1),
              (this.facDetailDig.image_bangpai_lishi.visible = !0),
              WebSocketService.send({ c: 1222, d: { id: i.id, pageNum: 0 } }),
              (this.facDetailDig.labe_detail_fac_title.text = "帮派历史"))
            : "xiangqing" == e &&
              ((this.facDetailDig.image_bangpai_detail.visible = !0),
              (this.facDetailDig.image_bangpai_lishi.visible = !1),
              WebSocketService.send({ c: 1196, d: { id: i.id } }),
              (this.facDetailDig.labe_detail_fac_title.text = i.name),
              Global.bangpaiID > 0
                ? (this.facDetailDig.btn_faction_jiaru.visible = !1)
                : (this.facDetailDig.btn_faction_jiaru.visible = !0)),
          this.facDetailDig
        );
      }),
      (t.prototype.onLoadBangPaiDetailFn = function (i) {
        0 == i.code &&
          ((this.label_fac_jiaozhu.text = i.data.lead),
          (this.lable_fac_descr.text = i.data.notice),
          (this.label_fac_bangpaijibie.text = i.data.lvl + "级"),
          (this.lable_fac_chengyuanshu.text = i.data.sum + "/" + i.data.maxSum),
          (this.lable_fac_yixian.text = i.data.one),
          (this.lable_fac_erxian.text = i.data.two),
          (this.lable_fac_sanxian.text = i.data.three),
          (this.lable_fac_rujiaodengji.text = i.data.minLvl + "级"),
          (this.lable_fac_shengming.text = i.data.credit));
      }),
      (t.prototype.onLoadBJiaruJiaoPaiFn = function (i) {
        i.code, ToastView.toastView(i.msg);
      }),
      (t.prototype.onDidClickJiaruBangPaiAction = function () {
        WebSocketService.send({ c: 1197, d: { id: this.facObj.id, type: 1 } });
      }),
      (t.prototype.onLoadBangPaiLiShiFn = function (i) {
        if (0 == i.code) {
          if (this.currentPage >= 1) {
            if (0 == i.list.length) return void this.currentPage--;
            for (a = 0; a < i.list.length; a++) {
              var t = i.list[a];
              this.listArr.push(t), (this.dataSource = []);
            }
          } else (this.listArr = i.list), (this.dataSource = []);
          this.isloading = !1;
          for (var e, a = 0; a < this.listArr.length; a++)
            (e = { label_fac_lishi: { text: this.listArr[a] } }),
              this.dataSource.push(e);
          this.list_faction_lishi.dataSource = this.dataSource;
        }
      }),
      (t.prototype.onLoadMoreJiaoPaiData = function (i) {
        var t = i / this.list_faction_lishi.scrollBar.max,
          e = new Date(),
          a = !1;
        if (
          (e.getTime() - this.spaceTime >= 3e3 && (a = !0),
          1 == t && 0 == this.isloading && a)
        )
          return (
            (this.isloading = !0),
            this.currentPage++,
            0 == this.list_faction_lishi.selectedIndex ||
              1 == this.list_faction_lishi.selectedIndex ||
              (2 == this.list_faction_lishi.selectedIndex &&
                WebSocketService.send({
                  c: 1222,
                  d: { id: this.facObj.id, pageNum: 0 },
                })),
            void (this.spaceTime = e.getTime())
          );
      }),
      t
    );
  })(ui.FactionController.FactionDetailDialogUI);
